package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;
import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.SexEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class InsuranceRecordAddRequest extends Request {


	/**
	 * 
	 */
	private static final long serialVersionUID = 7991397458421166232L;

	/**
	 * 账号ID
	 */
	private int userId;
	
	/**
	 * email
	 */
	private String email;
	
	/**
	 * 身份证
	 */
	private String identityCard;
	
	/**
	 * 投保人名
	 */
	private String name;
	
	/**
	 * 投保人手机号码
	 */
	private String phone;
	
	/**
	 * 投保人性别
	 */
	private Integer sex;
	
	/**
	 * 激活码
	 */
	private String code ;
	
	public InsuranceRecordAddRequest() {
		
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.code = requestInfo.getParameter(ApiUrlParamEnum.code.getParamName(), "");
		this.email = requestInfo.getParameter(ApiUrlParamEnum.email.getParamName(), "");
		this.phone = requestInfo.getParameter(ApiUrlParamEnum.phone.getParamName(), "");
		this.name = requestInfo.getParameter(ApiUrlParamEnum.name.getParamName(), "");
		this.identityCard = requestInfo.getParameter(ApiUrlParamEnum.identityCard.getParamName(), "");
		this.sex = requestInfo.getIntParameter(ApiUrlParamEnum.sex.getParamName(), SexEnum.MALE.getId());
		if(StringUtil.isEmpty(code)){
			throw new RequestIllegalException("error code:" + code);
		}
		if(StringUtil.isEmpty(identityCard)){
			throw new RequestIllegalException("error identityCard:" + identityCard);
		}
		
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getIdentityCard() {
		return identityCard;
	}

	public void setIdentityCard(String identityCard) {
		this.identityCard = identityCard;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	
	
}
